package com.example.designpattenexample.factorymethod.example;

public class ConcreteFruitGarden implements FruitGarden {

    @Override
    public <T extends Fruit> T factory(Class<T> c) {
        Fruit fruit = null;
        try {
            fruit = (Fruit) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (T) fruit;
    }
}
